﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace deckAnalyser.Controls
{
  public partial class EditorControl : UserControl
  {

    public event EventHandler OnChanged = null;

    public EditorControl()
    {
      InitializeComponent();
      textEditor.Document.HighlightingStrategy = ICSharpCode.TextEditor.Document.HighlightingStrategyFactory.CreateHighlightingStrategy("Boo");
      textEditor.Document.DocumentChanged += new ICSharpCode.TextEditor.Document.DocumentEventHandler(Document_DocumentChanged);
    }

    void Document_DocumentChanged(object sender, ICSharpCode.TextEditor.Document.DocumentEventArgs e)
    {
      if (OnChanged != null)
        OnChanged(this,e);
    }

    public String Source
    {
      get { return textEditor.Text; }
      set { textEditor.Document.TextContent = value; }
    }
  }
}
